#ifndef  _T_THREAD_H_
#define  _T_THREAD_H_

#include "../define/define.h"
#include "../util/bthread.h"
#include "tsocket.h"
#include "../util/epoll_single.h"

class tcp_sink;
class t_socket_server;

class  tcp_thread : public bthread
{
public:
   tcp_thread(tcp_sink* sink);
   ~tcp_thread();

   bool add_port(t_socket_server* tcp,uint16 port);
   bool del_port(uint32 port);
   
   bool del_socket(uint32 socket);
   
protected:

	void Execute();
	bool is_new_socket(uint32 socket);

private:

   tcp_sink* m_sink;
   std::map<uint16,t_socket_server*>  m_portmap;
   
   epoll_single*    m_single;
   logfile*         m_log;

};
#endif
